﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ASPNETVN.PORTAL.Components.Configuration;

namespace ASPNETVN.PORTAL.Modules.CMS.Home.Pages
{
    public partial class Slideshow8 : Page
    {
        protected string GetUrl(int itemID)
        {
            Guid moduleID = new Guid(Request.QueryString["mid"]);
            Guid tabID = Guid.Empty;
            PortalDataSet ds = PortalConfiguration.GetPortalDataSet();

            foreach (PortalDataSet.TabRow tab in ds.Tab.Rows)
            {
                foreach (PortalDataSet.ModuleRow module in tab.GetModuleRows())
                {
                    if (module.ID == new Guid(moduleID.ToString()))
                    {
                        return string.Format("~/Default.aspx?tabid={0}&mid={1}&itemid={2}&page=detail", tab.ID, module.ID, itemID);
                    }
                }
            }
            return string.Format("~/Default.aspx");
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Guid moduleID = new Guid(Request.QueryString["mid"]);

                // Get one type item for home.
                Repeater1.DataSource = Components.Item.GetItemsByDisplayType(moduleID, "ONE");
                Repeater1.DataBind();
            }
        }
    }
}
